/*
 * ChatUserInfoAction.java
 *
 * Created on 2007年5月17日, 上午10:43
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.pphome.orgmodel.action;



import com.ecomm.platcore.struts.support.BusinessException;
import com.ecomm.util.Logger;
import com.ecomm.platcore.struts.StrutsEntityAction;
import com.pphome.orgmodel.manager.OrgManager;
import com.pphome.orgmodel.pojo.OrgInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * <p>Title: 易讯聊天系统</p>
 * <p>Description:
 *  易讯聊天系统
 * </p>
 * <p>Copyright: Copyright (c) 2007</p>
 * <p>Company: 联合易讯 </p>
 * @author <font color='blue'>pijunliang</font> &nbsp&nbsp<a href="mailto:pijunliang@hotmail.com">pijunliang@hotmail.com</a>
 * @version 1.0
 * @since  2007年5月17日, 上午10:43
 */
public class OrgAction extends StrutsEntityAction<OrgInfo,OrgManager> {
    private Log log = Logger.getLog(OrgAction.class);
    
    private OrgManager orgManager=OrgManager.getInstance();
    /**
     *保存 或是修改 用户信息
     *
     */
    public ActionForward saveorupdate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
        OrgInfo object = doNewEntity(form, request);
        
        String id = request.getParameter(idName);
        // 将lazyform内容绑定到object
        initEntity(form, request, object);
        if(id != null && !id.equals("")){
            orgManager.doUpdateEntity(object);
        }else{
            id =  orgManager.doSaveEntity(object);
            object.setId(id); 
        }
        request.setAttribute("orginfo",object);
        return mapping.findForward(SUCCESS);
    }
}

